package io.renren.modules.yckj.service.impl;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.yckj.dao.ActivityDao;
import io.renren.modules.yckj.dto.ActivityDTO;
import io.renren.modules.yckj.entity.ActivityEntity;
import io.renren.modules.yckj.service.ActivityService;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 活动表
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2025-04-22
 */
@Service
public class ActivityServiceImpl extends CrudServiceImpl<ActivityDao, ActivityEntity, ActivityDTO> implements ActivityService {

    @Override
    public QueryWrapper<ActivityEntity> getWrapper(Map<String, Object> params) {
        String id = (String) params.get("id");
        Object status = params.get("status");
        String title = (String) params.get("title");

        QueryWrapper<ActivityEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StrUtil.isNotBlank(id), "id", id);
        wrapper.eq(ObjectUtil.isAllNotEmpty(status), "status", status);
        wrapper.like(StrUtil.isNotBlank(title), "title", title);

        return wrapper;
    }


}